Sensor cap system for inhalers